Skip to content

Move card filling to Nix#470

Merged
danieldk merged 4 commits intomainfrom
card-nix-build
Apr 16, 2026
Merged

Move card filling to Nix#470
danieldk merged 4 commits intomainfrom
card-nix-build

Conversation

@danieldk
Copy link
Copy Markdown
Member

This ensures that filled cards are in result as well (not just build) and keeps people that use Nix directly (i.e. me :-)) happy.

drbh
drbh previously approved these changes Apr 16, 2026
Copy link
Copy Markdown
Collaborator

@drbh drbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

question, this seems like this change will make the CARD.md non optional since if I'm reading correctly fill-card will throw if it cant find the template or if theres no repo-id? enforcing a card seems reasonable but just want to understand the change fully

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test too?

]

[general.hub]
repo-id = "kernels-test/cutlass-gemm-tvm-ffi"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am guessing the token is configured to write to kernels-test too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually upload these. I just needed to give them an identifier. We could also consider changing these to example/<name>, though that org seems to exist:

https://huggingface.co/Example

@@ -0,0 +1,48 @@
---
library_name: kernels
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-generated? 👀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure? This comes from the template that init uses:

https://github.com/huggingface/kernels/blob/main/kernel-builder/src/init/templates/CARD.md?plain=1

I have no idea where it comes from, maybe @drbh ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, added because I was using the output from the previous ModelCardData output which included the library name field

that being said its not fully clear if we need it since its really a model loading concept... maybe we can remove (no strong preference)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave that to a separate PR. No preference either.

@danieldk
Copy link
Copy Markdown
Member Author

question, this seems like this change will make the CARD.md non optional since if I'm reading correctly fill-card will throw if it cant find the template or if theres no repo-id? enforcing a card seems reasonable but just want to understand the change fully

Great catch. I first used a hook where I also checked the presence of CARD.md, but I forgot to port it to the current bundle post-install.

This ensures that filled cards are in `result` as well (not just `build`)
and keeps people that use Nix directly (i.e. me :-)) happy.
Copy link
Copy Markdown
Collaborator

@drbh drbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@danieldk danieldk requested a review from sayakpaul April 16, 2026 14:58
Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment concerning test as it seems like we're building first then validate card content.

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Copy Markdown

@H1235515648 H1235515648 Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.hsk hhhs 😂

Comment on lines +29 to +37
- name: Nix checks
run: nix build .\#checks.x86_64-linux.default
- name: Test kernel card generation
run: |
(
cd examples/kernels/silu-and-mul
nix build -L .
test -e result/CARD.md
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do we need to trigger an entire build to check for the card stuff? Seems like an overkill to me 👀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I guess it's simple and doesn't cost much?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a noarch kernel, so cheap. We need to do a bundle build to generate the card.

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating!

@danieldk danieldk merged commit 86fc31c into main Apr 16, 2026
41 checks passed
@danieldk danieldk deleted the card-nix-build branch April 16, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants